include(CMakeForceCompiler)

set(CMAKE_SYSTEM_NAME Generic)
#set(CMAKE_SYSTEM_VERSION 1)
#set(CMAKE_SYSTEM_PROCESSOR "arm7")

# specify the cross compiler
cmake_force_c_compiler(arm-none-eabi-gcc GNU)
set(CMAKE_ASM_COMPILER arm-none-eabi-as)
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -o <OBJECT> <SOURCE>")
# This is for locating files like headers and so on, since we are building our own
# kernel, we do not set the root path 
#SET(CMAKE_FIND_ROOT_PATH  /home/alex/src/ecos/install )

# Never lookup programs, or libraries as we are building the kernel itself
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)

set(TOOLCHAIN_ASM_FLAGS  "-mcpu=cortex-a8")
set(TOOLCHAIN_C_FLAGS    "-nostdinc -fno-builtin -mcpu=cortex-a8")
set(TOOLCHAIN_LINK_FLAGS "-nostartfiles")

set(TOOLCHAIN_OBJCOPY arm-none-eabi-objcopy)
set(TOOLCHAIN_AR arm-none-eabi-ar)
set(TOOLCHAIN_RANLIB arm-none-eabi-ranlib)

set(TOOLCHAIN_RT true)
